package com.ydl.learning.flink.demo;


import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;

/**
 * @author ydl
 * @since 2021/10/21
 */
public class JavaUtils {
  public static String o2jsonstr(Object o) {
    if (isNull(o)) {
      return "";
    }
    return JSONObject.toJSONString(o, SerializerFeature.DisableCircularReferenceDetect);
  }

  public static boolean isNull(Object o) {
    return o == null || StringUtils.isBlank(Objects.toString(o));
  }
}
